package com.timemetro.app;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.Button;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;


public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button buttonStartStation = (Button) findViewById(R.id.startStationButton);
        Button buttonEndStation = (Button) findViewById(R.id.endStationButton);
        ManagerViewElements.setButtonStartStation(buttonStartStation);
        ManagerViewElements.setButtonEndStation(buttonEndStation);
        try {
            ParsingXml.Parse(getApplicationContext());
            GraphCalculate.SetMatrix();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (XmlPullParserException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public void onClickStartStationButton(View view) throws InterruptedException {
        ManagerStation.setBeginStation(ManagerStation.getCurrentStation());
        ManagerViewElements.hideSelectStationPanel();

    }

    public void onClickEndStationButton(View view) throws InterruptedException {
        ManagerStation.setEndStation(ManagerStation.getCurrentStation());
        ManagerViewElements.hideSelectStationPanel();
    }
}
